// var n;
// var r = cc.Vec2;
// var c = cc.BlockInputEvents;
// var l = cc.Layout.ResizeMode;
// var d = cc.Layout.VerticalDirection;
// var u = cc.Label.HorizontalAlign;
// var h = cc.Label.VerticalAlign;
// var p = cc.Label.Overflow;
// var g = cc.Sprite.Type;
// var f = cc.Sprite.SizeMode;
// var $chestDialog = require("./AL_Framework_Chest_Dialog");
// var $buttonAction = require("./AL_Framework_Button_Action");
// var _ = cc._decorator;
// var v = _.ccclass;
// var w = _.property;
// var S = (function (e) {
//     function t() {
//         var t = (null !== e && e.apply(this, arguments)) || this;
//         t.gameButton = null;
//         t.topNodes = [];
//         t.layout = null;
//         t.buttonMoveY = 220;
//         t.handle_button_callback = null;
//         t.xiaohui_huidiao = null;
//         t.limitY = 0;
//         t.click_time = 0;
//         t.is_banner_show = !1;
//         t.isStartShow = !1;
//         t.loadFailTimes = 0;
//         return t;
//     }
//     var o;
//     __extends(t, e);
//     o = t;
//     t.prototype.onLoad = function () {
//         ailin_sdk_manager.yincangBannerGuanggao();
//     };
//     t.prototype.start = function () {
//         var e = this;
//         this.gameButton.on(cc.Node.EventType.TOUCH_END, this.game_Button_Click, this);
//         this.fill_Content();
//         var t = cc.repeatForever(
//             cc.sequence(
//                 cc.moveBy(1, new r(0, 100)),
//                 cc.callFunc(function () {
//                     if (e.layout.position.y > e.limitY) {
//                         console.log("move down");
//                         e.layout.stopAllActions();
//                         e.layout.runAction(o);
//                     }
//                 })
//             )
//         );
//         var o = cc.repeatForever(
//             cc.sequence(
//                 cc.moveBy(1, new r(0, -100)),
//                 cc.callFunc(function () {
//                     if (e.layout.position.y < 400) {
//                         e.layout.stopAllActions();
//                         e.layout.runAction(t);
//                     }
//                 })
//             )
//         );
//         this.layout.runAction(t);
//         var i = ailin_sdk_manager.instance.qg_gengduo_youxi_shuju[0];
//         if (i) {
//             ailin_sdk_manager.tiaozhuanDaoXinApp({
//                 source: oppo_get_online_dataId,
//                 data: i.jumpData,
//                 success: function () {
//                     try {
//                         ailin_sdk_manager.shezhiGuanggaoZhuizong(
//                             ailin_sdk_manager.instance.qg_gengduo_youxi_shuju[0].id,
//                             8,
//                             ailin_sdk_manager.instance.qg_gengduo_youxi_shuju[0].targetUniqueGame
//                         );
//                     } catch (e) {
//                         console.log("tiaozhuanDaoXinApp: " + JSON.stringify(e));
//                     }
//                 }
//             });
//         }
//     };
//     t.prototype.update = function () {};
//     t.prototype.game_Button_Click = function () {
//         console.log("chestDialog handle_event_click_button: 是否走流程 " + ailin_sdk_manager.instance.youxi_panhangbang_duihuakuan_shifou_shiyongzhong);
//         if (!ailin_sdk_manager.instance.youxi_panhangbang_duihuakuan_shifou_shiyongzhong) {
//             if (this.handle_button_callback) {
//                 this.handle_button_callback();
//             }
//             return void this.node.destroy();
//         }
//         this.click_time++;
//         console.log(this.is_banner_show + "; " + this.isStartShow);
//         if (!this.is_banner_show && !this.isStartShow) {
//             this.isStartShow = !0;
//             var e = this;
//             ailin_sdk_manager.xianshiBannerGuanggao({
//                 successCallback: function () {
//                     e.scheduleOnce(function () {
//                         if (e) {
//                             e.is_banner_show = !0;
//                         }
//                         if (e) {
//                             e.gameButton.runAction(cc.moveBy(0.1, new cc.Vec2(0, e.buttonMoveY)));
//                         }
//                     }, 0.5);
//                 },
//                 errorCallback: function () {
//                     e.isStartShow = !1;
//                     e.loadFailTimes++;
//                     if (e.loadFailTimes >= 3 && e) {
//                         e.is_banner_show = !0;
//                     }
//                 }
//             });
//         }
//         if (this.is_banner_show) {
//             if (this.handle_button_callback) {
//                 this.handle_button_callback();
//             }
//             this.node.destroy();
//         }
//     };
//     t.prototype.fill_Content = function () {
//         var e = ailin_sdk_manager.instance.qg_gengduo_youxi_shuju;
//         var t = e.slice(0, 3);
//         var i = e.slice(3);
//         this.limitY = i.length * o.huoqu_item_jiedian().height - 400;
//         console.log("limitY: " + this.limitY, t.length, i.length);
//         var n = this;
//         console.log("================1: " + t.length + "; " + i.length + "; " + this.topNodes.length);
//         t.forEach(function (e, t) {
//             var o = n.topNodes[t];
//             console.log("data1: ", o);
//             console.log("================: " + o);
//             o.getChildByName("num").getComponent(cc.Label).string = "" + (t + 1);
//             o.getChildByName("name").getComponent(cc.Label).string = e.gameName;
//             cc.loader.load(e.url, function (e, t) {
//                 o.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(t);
//             });
//             o.on(
//                 cc.Node.EventType.TOUCH_END,
//                 function () {
//                     ailin_sdk_manager.tiaozhuanDaoXinApp({
//                         source: oppo_get_online_dataId,
//                         data: e.jumpData,
//                         success: function () {
//                             try {
//                                 ailin_sdk_manager.shezhiGuanggaoZhuizong(e.id, 10, e.targetUniqueGame);
//                             } catch (e) {
//                                 console.log("tiaozhuanDaoXinApp: " + JSON.stringify(e));
//                             }
//                         }
//                     });
//                 },
//                 o
//             );
//         });
//         i.forEach(function (e, t) {
//             var i = o.huoqu_item_jiedian();
//             console.log("data2: ", i, e);
//             if (i) {
//                 cc.loader.load(e.url, function (e, t) {
//                     i.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(t);
//                 });
//                 i.getChildByName("num").getComponent(cc.Label).string = "" + (t + 1);
//                 i.getChildByName("name").getComponent(cc.Label).string = e.gameName;
//                 i.on(
//                     cc.Node.EventType.TOUCH_END,
//                     function () {
//                         ailin_sdk_manager.tiaozhuanDaoXinApp({
//                             source: oppo_get_online_dataId,
//                             data: e.jumpData,
//                             success: function () {
//                                 try {
//                                     ailin_sdk_manager.shezhiGuanggaoZhuizong(e.id, 10, e.targetUniqueGame);
//                                 } catch (e) {
//                                     console.log("tiaozhuanDaoXinApp: " + JSON.stringify(e));
//                                 }
//                             }
//                         });
//                     },
//                     i
//                 );
//                 n.layout.addChild(i);
//             }
//         });
//     };
//     t.showGameRankActivity = function (e) {
//         console.log("showGameRankActivity");
//         var t = o.chuangjian_yuzhiti();
//         t.x = 360;
//         t.y = 640;
//         t.getComponent(o).chushihua_shuju(e);
//         cc.director.getScene().addChild(t);
//     };
//     t.prototype.chushihua_shuju = function (e) {
//         var t = this;
//         if (e.handle_button_callback) {
//             this.handle_button_callback = e.handle_button_callback;
//         }
//         if (e.xiaohui_huidiao) {
//             this.xiaohui_huidiao = e.xiaohui_huidiao;
//         }
//         if (e.buttonImgPath) {
//             cc.loader.loadRes(e.buttonImgPath, cc.SpriteFrame, function (e, o) {
//                 e
//                     ? console.log("initDataErr: " + JSON.stringify(e))
//                     : (t.gameButton.getComponent(cc.Sprite).spriteFrame = o);
//             });
//         }
//     };
//     t.prototype.onDestroy = function () {
//         ailin_sdk_manager.yincangBannerGuanggao();
//         if (this.xiaohui_huidiao) {
//             this.xiaohui_huidiao();
//         }
//     };
//     t.chuangjian_yuzhiti = function () {
//         var e = new cc.Node();
//         e.width = 720;
//         e.height = 1280;
//         var t = e.addComponent(cc.Widget);
//         t.isAlignVerticalCenter = !0;
//         t.isAlignHorizontalCenter = !0;
//         var i = new cc.Node();
//         i.width = 2160;
//         i.height = 3840;
//         $chestDialog.default.tianjia_jingling_tu(i, "Flower/img/common/whiteBg", g.SIMPLE, f.CUSTOM);
//         i.addComponent(c);
//         e.addChild(i);
//         var n = new cc.Node();
//         n.width = 720;
//         n.height = 800;
//         n.y = -100;
//         var a = n.addComponent(cc.ScrollView);
//         a.horizontal = !1;
//         a.vertical = !0;
//         a.inertia = !0;
//         a.brake = 0.75;
//         a.elastic = !0;
//         a.bounceDuration = 0.23;
//         a.cancelInnerEvents = !0;
//         var s = new cc.Node();
//         n.addChild(s);
//         var r = new cc.Node();
//         r.y = 400;
//         r.anchorY = 1;
//         var _ = r.addComponent(cc.Layout);
//         _.type = cc.Layout.Type.VERTICAL;
//         _.resizeMode = l.CONTAINER;
//         _.paddingTop = 0;
//         _.paddingBottom = 0;
//         _.spacingY = 0;
//         _.verticalDirection = d.TOP_TO_BOTTOM;
//         _.affectedByScale = !1;
//         s.addChild(r);
//         a.content = r;
//         e.addChild(n);
//         var v = new cc.Node();
//         $chestDialog.default.tianjia_jingling_tu(v, "Flower/img/common/whiteBg", g.SIMPLE, f.CUSTOM);
//         v.y = 470;
//         v.width = 720;
//         v.height = 340;
//         var w = new cc.Node();
//         w.addComponent(cc.Label).string = "热门游戏";
//         w.color = new cc.Color(255, 0, 0);
//         w.y = 130;
//         v.addChild(w);
//         var S = new cc.Node();
//         S.y = -20;
//         var C = new cc.Node();
//         C.name = "icon";
//         C.y = 43;
//         C.width = 130;
//         C.height = 130;
//         $chestDialog.default.tianjia_jingling_tu(C, "", g.SIMPLE, f.CUSTOM);
//         S.addChild(C);
//         var b = new cc.Node();
//         b.name = "bg";
//         S.addChild(b);
//         var A = new cc.Node();
//         A.name = "name";
//         var N = A.addComponent(cc.Label);
//         N.enableBold = !0;
//         N.horizontalAlign = u.CENTER;
//         N.verticalAlign = h.CENTER;
//         N.fontSize = 20;
//         N.lineHeight = 20;
//         N.overflow = p.NONE;
//         A.y = -75;
//         S.addChild(A);
//         var I = new cc.Node();
//         I.name = "num";
//         I.x = -53.5;
//         I.y = 100;
//         var T = I.addComponent(cc.Label);
//         T.overflow = p.NONE;
//         T.fontSize = 40;
//         T.lineHeight = 40;
//         T.horizontalAlign = u.CENTER;
//         T.verticalAlign = h.CENTER;
//         S.addChild(I);
//         var M = cc.instantiate(S);
//         var k = cc.instantiate(S);
//         M.x = -200;
//         M.y = -34;
//         k.x = 200;
//         k.y = -42;
//         $chestDialog.default.tianjia_jingling_tu(b, "Flower/img/middleActivity/img/01");
//         $chestDialog.default.tianjia_jingling_tu(M.getChildByName("bg"), "Flower/img/middleActivity/img/02");
//         $chestDialog.default.tianjia_jingling_tu(k.getChildByName("bg"), "Flower/img/middleActivity/img/03");
//         var D = new cc.Node();
//         D.scale = 0.7;
//         $chestDialog.default.tianjia_jingling_tu(D, "Flower/img/middleActivity/img/crown");
//         D.x = 52;
//         D.y = 107;
//         D.rotation = 20;
//         S.addChild(D);
//         v.addChild(S);
//         v.addChild(M);
//         v.addChild(k);
//         e.addChild(v);
//         var B = new cc.Node();
//         B.width = 720;
//         B.height = 140;
//         B.y = -(cc.winSize.height - B.height) / 2;
//         var O = new cc.Node();
//         O.addComponent($buttonAction.default);
//         $chestDialog.default.tianjia_jingling_tu(O, "Flower/img/middleActivity/img/startButton");
//         B.addChild(O);
//         e.addChild(B);
//         var L = e.addComponent(o);
//         L.gameButton = O;
//         L.layout = r;
//         L.topNodes.push(S);
//         L.topNodes.push(M);
//         L.topNodes.push(k);
//         console.log("size: ", cc.winSize, cc.view.getFrameSize());
//         var P = cc.winSize.width / 720;
//         var E = cc.winSize.height / 1280;
//         e.scale = P > E ? E : P;
//         return e;
//     };
//     t.huoqu_item_jiedian = function () {
//         var e = new cc.Node();
//         e.width = 720;
//         e.height = 150;
//         var t = new cc.Node();
//         t.width = 720;
//         t.height = 2;
//         t.y = 74;
//         $chestDialog.default.tianjia_jingling_tu(t, "Flower/img/common/whiteBg", g.SIMPLE, f.CUSTOM);
//         t.color = new cc.Color(0, 0, 0);
//         e.addChild(t);
//         var o = new cc.Node();
//         o.x = -320;
//         o.color = new cc.Color(0, 0, 0);
//         o.name = "num";
//         var i = o.addComponent(cc.Label);
//         i.overflow = p.NONE;
//         i.fontSize = 40;
//         i.lineHeight = 40;
//         i.horizontalAlign = u.CENTER;
//         i.verticalAlign = h.CENTER;
//         e.addChild(o);
//         var n = new cc.Node();
//         n.name = "icon";
//         n.x = -200;
//         n.width = 120;
//         n.height = 120;
//         $chestDialog.default.tianjia_jingling_tu(n, "", g.SIMPLE, f.CUSTOM);
//         e.addChild(n);
//         var a = new cc.Node();
//         a.x = -100;
//         a.anchorX = 0;
//         a.color = new cc.Color(45, 175, 255);
//         a.name = "name";
//         var s = a.addComponent(cc.Label);
//         s.overflow = p.NONE;
//         s.fontSize = 30;
//         s.lineHeight = 30;
//         s.horizontalAlign = u.CENTER;
//         s.verticalAlign = h.CENTER;
//         e.addChild(a);
//         var r = new cc.Node();
//         r.x = 250;
//         r.scale = 0.6;
//         r.width = 320;
//         r.height = 100;
//         $chestDialog.default.tianjia_jingling_tu(r, "Flower/img/middleActivity/img/playButton", g.SLICED, f.TRIMMED);
//         e.addChild(r);
//         console.log("node_item: ", e);
//         return e;
//     };
//     __decorate([w(cc.Node)], t.prototype, "gameButton", void 0);
//     __decorate([w(cc.Node)], t.prototype, "topNodes", void 0);
//     __decorate([w(cc.Node)], t.prototype, "layout", void 0);
//     return (o = __decorate([v], t));
// })(cc.Component);
// exports.default = S;


/**
 * 导入依赖模块
 */
const Vec2 = cc.Vec2;
const BlockInputEvents = cc.BlockInputEvents;
const ResizeMode = cc.Layout.ResizeMode;
const VerticalDirection = cc.Layout.VerticalDirection;
const HorizontalAlign = cc.Label.HorizontalAlign;
const VerticalAlign = cc.Label.VerticalAlign;
const Overflow = cc.Label.Overflow;
const SpriteType = cc.Sprite.Type;
const SpriteSizeMode = cc.Sprite.SizeMode;

const AL_Framework_Chest_Dialog = require('./AL_Framework_Chest_Dialog');
const AL_Framework_Button_Action = require('./AL_Framework_Button_Action');

const { ccclass, property } = cc._decorator;

/**
 * @classdesc 游戏主类
 */
@ccclass
class S extends cc.Component {
    @property(cc.Node)
    gameButton = null;

    @property(cc.Node)
    topNodes = [];

    @property(cc.Node)
    layout = null;

    buttonMoveY = 220;
    handle_button_callback = null;
    xiaohui_huidiao = null;
    limitY = 0;
    click_time = 0;
    is_banner_show = false;
    isStartShow = false;
    loadFailTimes = 0;

    /**
     * 加载时隐藏广告
     */
    onLoad() {
        ailin_sdk_manager.yincangBannerGuanggao();
    }

    /**
     * 初始化游戏组件及动作
     */
    start() {
        this.gameButton.on(cc.Node.EventType.TOUCH_END, this.game_Button_Click, this);
        this.fill_Content();

        const moveUpAction = cc.repeatForever(
            cc.sequence(
                cc.moveBy(1, new Vec2(0, 100)),
                cc.callFunc(() => {
                    if (this.layout.position.y > this.limitY) {
                        console.log("move down");
                        this.layout.stopAllActions();
                        this.layout.runAction(moveDownAction);
                    }
                })
            )
        );

        const moveDownAction = cc.repeatForever(
            cc.sequence(
                cc.moveBy(1, new Vec2(0, -100)),
                cc.callFunc(() => {
                    if (this.layout.position.y < 400) {
                        this.layout.stopAllActions();
                        this.layout.runAction(moveUpAction);
                    }
                })
            )
        );

        this.layout.runAction(moveUpAction);

        const gameData = ailin_sdk_manager.instance.qg_gengduo_youxi_shuju[0];
        if (gameData) {
            ailin_sdk_manager.tiaozhuanDaoXinApp({
                source: oppo_get_online_dataId,
                data: gameData.jumpData,
                success: () => {
                    try {
                        ailin_sdk_manager.shezhiGuanggaoZhuizong(
                            gameData.id,
                            8,
                            gameData.targetUniqueGame
                        );
                    } catch (err) {
                        console.log("tiaozhuanDaoXinApp: " + JSON.stringify(err));
                    }
                }
            });
        }
    }

    update() { }

    /**
     * 处理游戏按钮点击事件
     */
    game_Button_Click() {
        console.log("chestDialog handle_event_click_button: 是否走流程 " + ailin_sdk_manager.instance.youxi_panhangbang_duihuakuan_shifou_shiyongzhong);
        if (!ailin_sdk_manager.instance.youxi_panhangbang_duihuakuan_shifou_shiyongzhong) {
            if (this.handle_button_callback) {
                this.handle_button_callback();
            }
            return void this.node.destroy();
        }
        this.click_time++;
        console.log(this.is_banner_show + "; " + this.isStartShow);
        if (!this.is_banner_show && !this.isStartShow) {
            this.isStartShow = true;
            ailin_sdk_manager.xianshiBannerGuanggao({
                successCallback: () => {
                    this.scheduleOnce(() => {
                        if (this) {
                            this.is_banner_show = true;
                        }
                        if (this) {
                            this.gameButton.runAction(cc.moveBy(0.1, new Vec2(0, this.buttonMoveY)));
                        }
                    }, 0.5);
                },
                errorCallback: () => {
                    this.isStartShow = false;
                    this.loadFailTimes++;
                    if (this.loadFailTimes >= 3 && this) {
                        this.is_banner_show = true;
                    }
                }
            });
        }

        if (this.is_banner_show) {
            if (this.handle_button_callback) {
                this.handle_button_callback();
            }
            this.node.destroy();
        }
    }

    /**
     * 填充内容
     */
    fill_Content() {
        const gameData = ailin_sdk_manager.instance.qg_gengduo_youxi_shuju;
        const topData = gameData.slice(0, 3);
        const otherData = gameData.slice(3);
        this.limitY = otherData.length * S.huoqu_item_jiedian().height - 400;
        console.log("limitY: " + this.limitY, topData.length, otherData.length);

        topData.forEach((data, index) => {
            const node = this.topNodes[index];
            node.getChildByName("num").getComponent(cc.Label).string = `${index + 1}`;
            node.getChildByName("name").getComponent(cc.Label).string = data.gameName;
            cc.loader.load(data.url, (err, texture) => {
                node.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture);
            });
            node.on(cc.Node.EventType.TOUCH_END, () => {
                ailin_sdk_manager.tiaozhuanDaoXinApp({
                    source: oppo_get_online_dataId,
                    data: data.jumpData,
                    success: () => {
                        try {
                            ailin_sdk_manager.shezhiGuanggaoZhuizong(data.id, 10, data.targetUniqueGame);
                        } catch (err) {
                            console.log("tiaozhuanDaoXinApp: " + JSON.stringify(err));
                        }
                    }
                });
            });
        });

        otherData.forEach((data, index) => {
            const node = S.huoqu_item_jiedian();
            if (node) {
                cc.loader.load(data.url, (err, texture) => {
                    node.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture);
                });
                node.getChildByName("num").getComponent(cc.Label).string = `${index + 1}`;
                node.getChildByName("name").getComponent(cc.Label).string = data.gameName;
                node.on(cc.Node.EventType.TOUCH_END, () => {
                    ailin_sdk_manager.tiaozhuanDaoXinApp({
                        source: oppo_get_online_dataId,
                        data: data.jumpData,
                        success: () => {
                            try {
                                ailin_sdk_manager.shezhiGuanggaoZhuizong(data.id, 10, data.targetUniqueGame);
                            } catch (err) {
                                console.log("tiaozhuanDaoXinApp: " + JSON.stringify(err));
                            }
                        }
                    });
                });
                this.layout.addChild(node);
            }
        });
    }

    /**
     * 显示游戏排名活动
     * @param {Object} data
     */
    static showGameRankActivity(data) {
        console.log("showGameRankActivity");
        const node = S.chuangjian_yuzhiti();
        node.x = 360;
        node.y = 640;
        node.getComponent(S).chushihua_shuju(data);
        cc.director.getScene().addChild(node);
    }

    /**
     * 初始化数据
     * @param {Object} data
     */
    chushihua_shuju(data) {
        if (data.handle_button_callback) {
            this.handle_button_callback = data.handle_button_callback;
        }
        if (data.xiaohui_huidiao) {
            this.xiaohui_huidiao = data.xiaohui_huidiao;
        }
        if (data.buttonImgPath) {
            cc.loader.loadRes(data.buttonImgPath, cc.SpriteFrame, (err, spriteFrame) => {
                if (err) {
                    console.log("initDataErr: " + JSON.stringify(err));
                } else {
                    this.gameButton.getComponent(cc.Sprite).spriteFrame = spriteFrame;
                }
            });
        }
    }

    /**
     * 组件销毁时触发
     */
    onDestroy() {
        ailin_sdk_manager.yincangBannerGuanggao();
        if (this.xiaohui_huidiao) {
            this.xiaohui_huidiao();
        }
    }

    /**
     * 创建预制件
     */
    static chuangjian_yuzhiti() {
        const rootNode = new cc.Node();
        rootNode.width = 720;
        rootNode.height = 1280;

        const widget = rootNode.addComponent(cc.Widget);
        widget.isAlignVerticalCenter = true;
        widget.isAlignHorizontalCenter = true;

        const bgNode = new cc.Node();
        bgNode.width = 2160;
        bgNode.height = 3840;
        AL_Framework_Chest_Dialog.default.tianjia_jingling_tu(bgNode, "Flower/img/common/whiteBg", SpriteType.SIMPLE, SpriteSizeMode.CUSTOM);
        bgNode.addComponent(BlockInputEvents);
        rootNode.addChild(bgNode);

        const scrollViewNode = new cc.Node();
        scrollViewNode.width = 720;
        scrollViewNode.height = 800;
        scrollViewNode.y = -100;

        const scrollView = scrollViewNode.addComponent(cc.ScrollView);
        scrollView.horizontal = false;
        scrollView.vertical = true;
        scrollView.inertia = true;
        scrollView.brake = 0.75;
        scrollView.elastic = true;
        scrollView.bounceDuration = 0.23;
        scrollView.cancelInnerEvents = true;

        const contentNode = new cc.Node();
        scrollViewNode.addChild(contentNode);

        const layoutNode = new cc.Node();
        layoutNode.y = 400;
        layoutNode.anchorY = 1;

        const layout = layoutNode.addComponent(cc.Layout);
        layout.type = cc.Layout.Type.VERTICAL;
        layout.resizeMode = ResizeMode.CONTAINER;
        layout.paddingTop = 0;
        layout.paddingBottom = 0;
        layout.spacingY = 0;
        layout.verticalDirection = VerticalDirection.TOP_TO_BOTTOM;
        layout.affectedByScale = false;

        contentNode.addChild(layoutNode);
        scrollView.content = layoutNode;
        rootNode.addChild(scrollViewNode);

        const bannerNode = new cc.Node();
        AL_Framework_Chest_Dialog.default.tianjia_jingling_tu(bannerNode, "Flower/img/common/whiteBg", SpriteType.SIMPLE, SpriteSizeMode.CUSTOM);
        bannerNode.y = 470;
        bannerNode.width = 720;
        bannerNode.height = 340;

        const labelNode = new cc.Node();
        labelNode.addComponent(cc.Label).string = "热门游戏";
        labelNode.color = new cc.Color(255, 0, 0);
        labelNode.y = 130;
        bannerNode.addChild(labelNode);

        const itemNode = new cc.Node();
        itemNode.y = -20;

        const iconNode = new cc.Node();
        iconNode.name = "icon";
        iconNode.y = 43;
        iconNode.width = 130;
        iconNode.height = 130;
        AL_Framework_Chest_Dialog.default.tianjia_jingling_tu(iconNode, "", SpriteType.SIMPLE, SpriteSizeMode.CUSTOM);
        itemNode.addChild(iconNode);

        const bgChildNode = new cc.Node();
        bgChildNode.name = "bg";
        itemNode.addChild(bgChildNode);

        const nameLabelNode = new cc.Node();
        nameLabelNode.name = "name";
        const nameLabel = nameLabelNode.addComponent(cc.Label);
        nameLabel.enableBold = true;
        nameLabel.horizontalAlign = HorizontalAlign.CENTER;
        nameLabel.verticalAlign = VerticalAlign.CENTER;
        nameLabel.fontSize = 20;
        nameLabel.lineHeight = 20;
        nameLabel.overflow = Overflow.NONE;
        nameLabelNode.y = -75;
        itemNode.addChild(nameLabelNode);

        const numLabelNode = new cc.Node();
        numLabelNode.name = "num";
        numLabelNode.x = -53.5;
        numLabelNode.y = 100;
        const numLabel = numLabelNode.addComponent(cc.Label);
        numLabel.overflow = Overflow.NONE;
        numLabel.fontSize = 40;
        numLabel.lineHeight = 40;
        numLabel.horizontalAlign = HorizontalAlign.CENTER;
        numLabel.verticalAlign = VerticalAlign.CENTER;
        itemNode.addChild(numLabelNode);

        const itemNodeClone1 = cc.instantiate(itemNode);
        const itemNodeClone2 = cc.instantiate(itemNode);
        itemNodeClone1.x = -200;
        itemNodeClone1.y = -34;
        itemNodeClone2.x = 200;
        itemNodeClone2.y = -42;

        AL_Framework_Chest_Dialog.default.tianjia_jingling_tu(bgChildNode, "Flower/img/middleActivity/img/01");
        AL_Framework_Chest_Dialog.default.tianjia_jingling_tu(itemNodeClone1.getChildByName("bg"), "Flower/img/middleActivity/img/02");
        AL_Framework_Chest_Dialog.default.tianjia_jingling_tu(itemNodeClone2.getChildByName("bg"), "Flower/img/middleActivity/img/03");

        const crownNode = new cc.Node();
        crownNode.scale = 0.7;
        AL_Framework_Chest_Dialog.default.tianjia_jingling_tu(crownNode, "Flower/img/middleActivity/img/crown");
        crownNode.x = 52;
        crownNode.y = 107;
        crownNode.rotation = 20;
        itemNode.addChild(crownNode);

        bannerNode.addChild(itemNode);
        bannerNode.addChild(itemNodeClone1);
        bannerNode.addChild(itemNodeClone2);
        rootNode.addChild(bannerNode);

        const bottomNode = new cc.Node();
        bottomNode.width = 720;
        bottomNode.height = 140;
        bottomNode.y = -(cc.winSize.height - bottomNode.height) / 2;

        const buttonNode = new cc.Node();
        buttonNode.addComponent(AL_Framework_Button_Action.default);
        AL_Framework_Chest_Dialog.default.tianjia_jingling_tu(buttonNode, "Flower/img/middleActivity/img/startButton");
        bottomNode.addChild(buttonNode);
        rootNode.addChild(bottomNode);

        const instance = rootNode.addComponent(S);
        instance.gameButton = buttonNode;
        instance.layout = layoutNode;
        instance.topNodes.push(itemNode);
        instance.topNodes.push(itemNodeClone1);
        instance.topNodes.push(itemNodeClone2);

        console.log("size: ", cc.winSize, cc.view.getFrameSize());

        const scaleWidth = cc.winSize.width / 720;
        const scaleHeight = cc.winSize.height / 1280;
        rootNode.scale = scaleWidth > scaleHeight ? scaleHeight : scaleWidth;

        return rootNode;
    }

    /**
     * 获取项目节点
     * @returns {cc.Node}
     */
    static huoqu_item_jiedian() {
        const itemNode = new cc.Node();
        itemNode.width = 720;
        itemNode.height = 150;

        const separatorNode = new cc.Node();
        separatorNode.width = 720;
        separatorNode.height = 2;
        separatorNode.y = 74;
        AL_Framework_Chest_Dialog.default.tianjia_jingling_tu(separatorNode, "Flower/img/common/whiteBg", SpriteType.SIMPLE, SpriteSizeMode.CUSTOM);
        separatorNode.color = new cc.Color(0, 0, 0);
        itemNode.addChild(separatorNode);

        const numNode = new cc.Node();
        numNode.name = "num";
        numNode.x = -320;
        numNode.color = new cc.Color(0, 0, 0);
        const numLabel = numNode.addComponent(cc.Label);
        numLabel.overflow = Overflow.NONE;
        numLabel.fontSize = 40;
        numLabel.lineHeight = 40;
        numLabel.horizontalAlign = HorizontalAlign.CENTER;
        numLabel.verticalAlign = VerticalAlign.CENTER;
        itemNode.addChild(numNode);

        const iconNode = new cc.Node();
        iconNode.name = "icon";
        iconNode.x = -200;
        iconNode.width = 120;
        iconNode.height = 120;
        AL_Framework_Chest_Dialog.default.tianjia_jingling_tu(iconNode, "", SpriteType.SIMPLE, SpriteSizeMode.CUSTOM);
        itemNode.addChild(iconNode);

        const nameNode = new cc.Node();
        nameNode.name = "name";
        nameNode.x = -100;
        nameNode.anchorX = 0;
        nameNode.color = new cc.Color(45, 175, 255);
        const nameLabel = nameNode.addComponent(cc.Label);
        nameLabel.overflow = Overflow.NONE;
        nameLabel.fontSize = 30;
        nameLabel.lineHeight = 30;
        nameLabel.horizontalAlign = HorizontalAlign.CENTER;
        nameLabel.verticalAlign = VerticalAlign.CENTER;
        itemNode.addChild(nameNode);

        const playButtonNode = new cc.Node();
        playButtonNode.x = 250;
        playButtonNode.scale = 0.6;
        playButtonNode.width = 320;
        playButtonNode.height = 100;
        AL_Framework_Chest_Dialog.default.tianjia_jingling_tu(playButtonNode, "Flower/img/middleActivity/img/playButton", SpriteType.SLICED, SpriteSizeMode.TRIMMED);
        itemNode.addChild(playButtonNode);

        console.log("node_item: ", itemNode);
        return itemNode;
    }
}

export default S;
